<%--
  Created by IntelliJ IDEA.
  User: 王德明
  Date: 2018/5/15
  Time: 17:22
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>

<div class="animated fadeInRight">
    <div class="wrapper wrapper-content ng-scope">
        <div class="row" ng-controller="operationWithdrawalCtrl">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{{ isTitle | translate }}</h5>
                    </div>

                    <div class="ibox-content sk-loading">

                        <div class="sk-spinner sk-spinner-wave">
                            <div class="sk-rect1"></div>
                            <div class="sk-rect2"></div>
                            <div class="sk-rect3"></div>
                            <div class="sk-rect4"></div>
                            <div class="sk-rect5"></div>
                        </div>

                        <form name="myform" serializer="searchWithdrawal(data)">
                            <div class="row">
                                <!--商户号-->
                                <div class="col-sm-6 col-md-6 col-lg-3">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">商户号：</span>
                                            <div uib-tooltip="可通过商户名称搜索商户号"
                                                 angucomplete-alt id="merId"
                                                 input-name="merId"
                                                 maxlength="10"
                                                 pause="100"
                                                 auto-match="true"
                                                 selected-object="selectedMerchant"
                                                 local-data="merchant"
                                                 search-fields="id,name"
                                                 title-field="id"
                                                 description-field="name"
                                                 minlength="0"
                                                 focus-first="true"
                                                 input-class="form-control form-control-small"
                                                 match-class="highlight">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--申请人-->
                                <div class="col-sm-6 col-md-6 col-lg-3">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">申请人：</span>
                                            <input type="text" id="applicant" name="applicant" class="form-control"
                                                   ng-model="searchInfo.applicant">
                                        </div>
                                    </div>
                                </div>

                                <!--审核起始时间-->
                                <div class="col-sm-6 col-md-6 col-lg-3" ng-if="isAuditTime">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">审核起始日期：</span>
                                            <input type="text" id="auditBeginDate" name="auditBeginDate"
                                                   uib-tooltip="可只选择起始日期查询起始日期至今订单"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker1()"
                                                   uib-datepicker-popup="{{format}}" ng-model="auditBeginDate"
                                                   is-open="popup1.opend"
                                                   datepicker-options="dateOptions1"
                                                   close-text="关闭" alt-input-formats="altInputFormats"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker1()">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>

                                <!--审核结束时间-->
                                <div class="col-sm-6 col-md-6 col-lg-3" ng-if="isAuditEndTime">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">审核结束日期：</span>
                                            <input type="text" id="auditEndDate" name="auditEndDate"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker2()"
                                                   uib-datepicker-popup="{{format}}" ng-model="auditEndDate"
                                                   is-open="popup2.opend"
                                                   datepicker-options="dateOptions2"
                                                   close-text="关闭" alt-input-formats="altInputFormats"
                                                   ng-disabled="auditEndDateDisable"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker2()"
                                                    ng-disabled="auditEndDateDisable">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>
                                <!--申请时间-->
                                <div class="col-sm-6 col-md-6 col-lg-3">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">申请起始日期：</span>
                                            <input type="text" id="applyTime" name="applyTime"
                                                   uib-tooltip="可只选择起始日期查询起始日期至今订单"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker3()"
                                                   uib-datepicker-popup="{{format}}"
                                                   ng-model="searchInfo.applyTime"
                                                   is-open="popup3.opend"
                                                   datepicker-options="dateOptions1"
                                                   close-text="关闭" alt-input-formats="altInputFormats"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker3()">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>

                                <!--申请结束时间-->
                                <div class="col-sm-6 col-md-6 col-lg-3">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">申请结束日期：</span>
                                            <input type="text" id="applyEndTime" name="applyEndTime"
                                                   class="form-control" ng-readonly="true" ng-click="openDatepicker4()"
                                                   uib-datepicker-popup="{{format}}"
                                                   ng-model="searchInfo.applyEndTime"
                                                   is-open="popup4.opend"
                                                   datepicker-options="dateOptions2"
                                                   close-text="关闭" alt-input-formats="altInputFormats"
                                                   ng-disabled="applyOverTimeDisable"
                                                   close-text="关闭" clear-text="清空" current-text="今天">
                                            <span class="input-group-btn">
                                            <button type="button" class="btn btn-default btn-sm no-margins"
                                                    ng-click="openDatepicker4()"
                                                    ng-disabled="applyOverTimeDisable">
                                                <i class="fa fa-calendar"></i>
                                            </button>
                                        </span>
                                        </div>
                                    </div>
                                </div>

                                <!--审核人-->
                                <div class="col-sm-6 col-md-6 col-lg-3" ng-if="isShowReviewInfo">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">审核人：</span>
                                            <input type="text" id="reviewer" name="reviewer" class="form-control">
                                        </div>
                                    </div>
                                </div>

                                <!--划款人-->
                                <div class="col-sm-6 col-md-6 col-lg-3" ng-if="isShowTransferInfo">
                                    <div class="form-group form-group-sm">
                                        <div class="input-group">
                                            <span class="input-group-addon">划款人：</span>
                                            <input type="text" id="transfer" name="transfer" class="form-control">
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-sm-6 col-md-6 col-lg-3 col-lg-offset-3">
                                        <button type="submit" class="btn btn-sm btn-w-m btn-primary pull-right">
                                            查询
                                        </button>
                                    </div>
                                    <div class="col-sm-6 col-md-6 col-lg-3">
                                        <button type="button" class="btn btn-sm btn-w-m btn-info"
                                                ng-click="resetForm()">
                                            重置
                                        </button>
                                    </div>

                                </div>
                                <div class="pull-right col-sm-6 col-md-6 col-lg-3">
                                    <button type="button" class="pull-right btn btn-sm btn-sm btn-success export-btn"
                                            ng-click="printForm()">
                                        <i class="fa fa-download"></i>&nbsp;打印
                                    </button>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="table-responsive">
                                <table ng-table="WithdrawalTable"
                                       class="table orderChangetable table-condensed table-striped table-hover table-bordered">
                                    <tr ng-repeat="row in $data">
                                        <td class="text-center" data-title="'提现流水号'">
                                            {{row.id}}
                                        </td>
                                        <td class="text-center" data-title="'商户号'">
                                            {{ row.ref_id }}
                                        </td>
                                        <td class="text-center" data-title="'提现金额'">
                                            {{ row.amount }} {{ row.currency }}
                                        </td>
                                        <td class="text-center" data-title="'交易汇率'">
                                            {{ row.rate }}
                                        </td>
                                        <td class="text-center" data-title="'申请人'">
                                            {{ row.applicant }}
                                        </td>
                                        <td class="text-center" data-title="'申请时间'">
                                            {{ row.application_time | date: 'yyyy-MM-dd hh:mm:ss' }}
                                        </td>
                                        <td class="text-center" data-title="'审核人'" ng-if="isShow">
                                            {{ row.auditor }}
                                        </td>
                                        <td class="text-center" data-title="'审核时间'" ng-if="isShow">
                                            {{ row.audit_time | date: 'yyyy-MM-dd hh:mm:ss' }}
                                        </td>
                                        <td class="text-center" data-title="'状态'">
                                            {{ row.statusName }}
                                        </td>
                                        <div>
                                            <td class="text-center" style="max-width: 70px" data-title="'审核备注'"
                                                ng-if="isShowAuditRemark">
                                                <div class="hidden-text" uib-tooltip="{{ row.remark }}">
                                                    {{ row.remark }}
                                                </div>
                                            </td>
                                            <td class="text-center" style="max-width: 70px" data-title="'复核描述'"
                                                ng-if="isShowReviewRemark">
                                                <div class="hidden-text" uib-tooltip="{{ row.review_remark }}">
                                                    {{ row.review_remark }}
                                                </div>
                                            </td>
                                        </div>
                                        <td class="text-center" data-title="'操作'">
                                            <div ng-show="row.statusName == '待审核'">
                                                <div ng-switch="currentType">
                                                    <div ng-switch-when="1">
                                                        <button class="btn btn-xs btn-success"
                                                                style="margin: 0 0 0 10px" ng-click="showModal(row)">审核
                                                        </button>
                                                        <div ng-switch-default>
                                                            待审核
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-show="row.statusName == '待复核'">
                                                <div ng-switch="currentType">
                                                    <div ng-switch-when="5">
                                                        <button class="btn btn-xs btn-success"
                                                                style="margin: 0 0 0 10px" ng-click="showModal(row)">复核
                                                        </button>
                                                    </div>
                                                    <div ng-switch-default>
                                                        待复核
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-show="row.statusName == '已划款'">
                                                已划款
                                            </div>
                                            <div ng-show="row.statusName == '无效'">
                                                无效
                                            </div>
                                            <div ng-show="row.statusName == '待划款'">
                                                <div ng-switch="currentType">
                                                    <div ng-switch-when="2">
                                                        <button class="btn btn-xs btn-success"
                                                                style="margin: 0 0 0 10px"
                                                                ng-click="showModal(row,currentType)">划款
                                                        </button>
                                                    </div>
                                                    <div ng-switch-default>
                                                        待划款
                                                    </div>
                                                </div>
                                            </div>
                                            <div ng-show="row.statusName == '自动扣款'">
                                                自动划款
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <my-pagination table-param="WithdrawalTable"></my-pagination>

                        </form>
                    </div>
                </div>
            </div>
            <%--打印的表格--%>
            <div class="printArea" style="display: none">
                <center>
                    <div class="formlist">
                        <table width="100%" border="0" style="outline: none;">
                            <tbody>
                            <tr>
                                <td width="100%">
                                    <div align="center" class="STYLE1">商户划款通知</div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"
                               style="margin-top: 24px;outline: none;">
                            <tbody>
                            <tr>
                                <td width="40%" style="text-align:left">公司名称:厦门市融信汇网络科技有限公司</td>
                                <td width="30%" style="padding-left:45px;">日期: {{ now | date: 'yyyy-MM-dd' }}
                                </td>
                                <td width="30%" style="text-align:right">单据编号:{{ now | date:'yyyyMMddhhmmss' }}</td>
                            </tr>
                            </tbody>
                        </table>
                        <table width="100%" height="300px" border="1" align="center"
                               cellpadding="0" cellspacing="0" style="outline: none;">
                            <tbody>

                            <tr>
                                <th width="16%" align="center">商户名称</th>
                                <th width="30%" align="center">{{printData[0].name}}</th>
                                <th width="16%" align="center">商户号</th>
                                <th width="30%" align="center">{{printData[0].id}}</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">序号</th>
                                <th width="30%" align="center">币种</th>
                                <th width="16%" align="center">汇率</th>
                                <th width="30%" align="center">提现金额</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">1</th>
                                <th width="30%" align="center">{{printData[0].currency}}</th>
                                <th width="16%" align="center">{{printData[0].rate}}</th>
                                <th width="30%" align="center">{{printData[0].amount}}</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">2</th>
                                <th width="30%" align="center">{{printData[1].currency}}</th>
                                <th width="16%" align="center">{{printData[1].rate}}</th>
                                <th width="30%" align="center">{{printData[1].amount}}</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">3</th>
                                <th width="30%" align="center">{{printData[2].currency}}</th>
                                <th width="16%" align="center">{{printData[2].rate}}</th>
                                <th width="30%" align="center">{{printData[2].amount}}</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">4</th>
                                <th width="30%" align="center">{{printData[3].currency}}</th>
                                <th width="16%" align="center">{{printData[3].rate}}</th>
                                <th width="30%" align="center">{{printData[3].amount}}</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">5</th>
                                <th width="30%" align="center">{{printData[4].currency}}</th>
                                <th width="16%" align="center">{{printData[4].rate}}</th>
                                <th width="30%" align="center">{{printData[4].amount}}</th>
                            </tr>


                            <th width="16%" align="center">大写金额</th>
                            <th width="30%" align="center">
                                {{amountWords}}
                            </th>
                            <th width="16%" align="center">小计</th>
                            <th width="30%" align="center">{{total}}</th>

                            <tr>
                                <th width="16%" align="center">不可用余额</th>
                                <th width="30%" align="center">{{printData[0].disabledAmount}}</th>
                                <th width="16%" align="center">可用余额</th>
                                <th width="30%" align="center">{{printData[0].usableAmount}}</th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">收款人</th>
                                <th width="30%" align="center">{{printData[0].bankOwner}}</th>
                                <th width="16%" align="center">实际划款额</th>
                                <th width="30%" align="center"></th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">开户银行</th>
                                <th width="46%" align="center">{{printData[0].bankName}}</th>
                                <th width="16%" style="text-align:left;vertical-align:top" rowspan="2" colspan="2">备注:
                                </th>
                            </tr>
                            <tr>
                                <th width="16%" align="center">银行账号</th>
                                <th width="46%" align="center">{{printData[0].bankAccount}}</th>
                            </tr>
                            </tbody>
                        </table>
                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"
                               style="outline: none;">
                            <tbody>
                            <tr>
                                <td width="40%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总经理：</td>
                                <td width="30%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;财务：</td>
                                <td width="30%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;出纳：</td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <p>&nbsp;</p>
                </center>
            </div>
        </div>
    </div>
</div>


